/******************************************************************************
* File description: settingmodelconfigui.cpp
* Function: 设置-模型配置
* Current Version: 1.0.0
* Author: 张宇轩
* Date: 2024-08-30
*  -----
*  Copyright by 博坤生物 .
 *****************************************************************************/
#include "settingmodelconfigui.h"

SettingModelConfigUI::SettingModelConfigUI() {
    // 初始化
    this->setResizeMode(QQuickWidget::SizeRootObjectToView);
    this->setSource(QUrl("qrc:/SettingModelConfig.qml"));

    filterUI = new SettingModelConfigFilterUI();
    filterUI->setParent(this, Qt::Window | Qt::WindowCloseButtonHint);
    hunHeUI = new SettingModelConfigHunHeUI();
    hunHeUI->setParent(this, Qt::Window | Qt::WindowCloseButtonHint);
    changePwdUI = new SettingModelConfigChangePwdUI();
    changePwdUI->setParent(this, Qt::Window | Qt::WindowCloseButtonHint);

    rootObj = this->getRootObject();
    if(rootObj){
        connect(rootObj, SIGNAL(filterPage()), this, SLOT(onFilterPage()));
        connect(rootObj, SIGNAL(hunhePage()), this, SLOT(onHunHePage()));
        connect(rootObj, SIGNAL(changePwdPage()), this, SLOT(onChangePwdPage()));
        connect(rootObj, SIGNAL(settingReturnSig()), this, SIGNAL(settingReturnSig()));
    }
}

SettingModelConfigUI::~SettingModelConfigUI() {}

/**
 * @brief getContext 获取qmlcontext
 * @return qmlContext
 */
QQmlContext* SettingModelConfigUI::getContext() const
{
    return this->rootContext();
}

/**
 * @brief getRootObject 获取rootObject
 * @return rootObject
 */
QObject* SettingModelConfigUI::getRootObject() const
{
    return (QObject*)this->rootObject();
}

/**
 * @brief 筛选页面
 */
void SettingModelConfigUI::onFilterPage()
{
    this->filterUI->show();
}

/**
 * @brief 混合页面
 */
void SettingModelConfigUI::onHunHePage()
{
    this->hunHeUI->show();
}

/**
 * @brief 密码页面
 */
void SettingModelConfigUI::onChangePwdPage()
{
    this->changePwdUI->show();
}
